Drawing Trees
نویسنده
چکیده
This article describes the application of functional programming techniques to a problem previously studied by imperative programmers, that of drawing general trees automatically. We rst consider the nature of the problem and the ideas behind its solution (due to Radack), independent of programming language implementation. We then describe a Standard ML program which reeects the structure of the abstract solution much better than an imperative language implementation. We conclude with an informal discussion on the correctness of the implementation and some changes which improve the algorithm's worst-case time complexity. 1 The problem and its solution The problem is this: given a labelled tree, assign to each node a position on the page to give an aesthetically pleasing rendering of the tree. We assume that nodes at the same depth are positioned on the same horizontal line on the page, so the problem reduces to nding a position horizontally for each node. But what do we mean by \aesthetically pleasing"? The various papers on the subject 1990) list aesthetic rules which constrain the positions in a number of ways. We adopt the same rules as Radack and Walker: 1. Two nodes at the same level should be placed at least a given distance apart. 2. A parent should be centred over its oospring. 3. Tree drawings should be symmetrical with respect to reeection|a tree and its mirror image should produce drawings that are reeections of each other. In particular, this means that symmetric trees will be rendered symmetrically. So, for example, Figure 1 shows two renderings, the rst bad, the second good. 4. Identical subtrees should be rendered identically|their position in the larger tree should not aaect their appearance. In Figure 2 the tree on the left fails the test, and the one on the right passes.
منابع مشابه
A New Heuristic Algorithm for Drawing Binary Trees within Arbitrary Polygons Based on Center of Gravity
Graphs have enormous usage in software engineering, network and electrical engineering. In fact graphs drawing is a geometrically representation of information. Among graphs, trees are concentrated because of their ability in hierarchical extension as well as processing VLSI circuit. Many algorithms have been proposed for drawing binary trees within polygons. However these algorithms generate b...
متن کاملArea-eecient Algorithms for Upward Straight-line Tree Drawings ?
In this paper, we investigate planar upward straight-line grid drawing problems for bounded-degree rooted trees so that a drawing takes up as little area as possible. A planar upward straight-line grid tree drawing satisses the following four constraints: (1) all vertices are placed at distinct grid points (grid), (2) all edges are drawn as straight lines (straight-line), (3) no two edges in th...
متن کاملOn Upward Drawings of Trees on a Given Grid
Computing a minimum-area planar straight-line drawing of a graph is known to be NP-hard for planar graphs, even when restricted to outerplanar graphs. However, the complexity question is open for trees. Only a few hardness results are known for straight-line drawings of trees under various restrictions such as edge length or slope constraints. On the other hand, there exist polynomial-time algo...
متن کاملOptimal Monotone Drawings of Trees
A monotone drawing of a graph G is a straight-line drawing of G such that, for every pair of vertices u,w in G, there exists a path Puw in G that is monotone in some direction luw. (Namely, the order of the orthogonal projections of the vertices of Puw on luw is the same as the order they appear in Puw.) The problem of finding monotone drawings for trees has been studied in several recent paper...
متن کاملImproved Bounds for Drawing Trees on Fixed Points with L-Shaped Edges
Let T be an n-node tree of maximum degree 4, and let P be a set of n points in the plane with no two points on the same horizontal or vertical line. It is an open question whether T always has a planar drawing on P such that each edge is drawn as an orthogonal path with one bend (an “L-shaped” edge). By giving new methods for drawing trees, we improve the bounds on the size of the point set P f...
متن کاملDrawing Free Trees Inside Simple Polygons Using Polygon Skeleton
Most of graph drawing algorithms draw graphs on unbounded planes. In this paper we introduce a new polyline grid drawing algorithm for drawing free trees on plane regions which are bounded by simple polygons. Our algorithm uses the simulated annealing (SA) method, and by means of the straight skeletons of the bounding polygons guides the SA method to uniformly distribute the vertices of the giv...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید
ثبت ناماگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید
ورودعنوان ژورنال:
- J. Funct. Program.
دوره 6 شماره
صفحات -
تاریخ انتشار 1996